﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    Layout = "~/Views/Shared/_Main.cshtml";
    ItemListBox<Business> list = ViewBag.Business;
}


<!--#主菜单-->
<div class="container">
<ul class="breadcrumb">
    <li><a href="/home/index">首页</a> <span class="divider">/</span></li>
    <li class="active">订餐商家列表</li>
</ul>
<!--//////////////////////////////////////////////////////////////////////////////////-->
<div class="row">

<div class="span9" style=" width:98%;">

<!--//////////////////////////////////////////////////////////////////////////////////-->
<!--商家列表-->
@{
    if (list != null && list.Data != null && list.Data.Count != 0)
    {
        string imgurl = "";
        int sellProductNumber = 0;
        int id=0;
        int key=0;
        string isWork="正在营业";
        string url="/shop/FastFoodBusiness?d="+list.Data[key].Id;
        for (int i = 0; i < list.Data.Count; i++)
        {
           
        
<div class="row-fluid" >
@{
            for (int j=0; j<3;j++)
            {
                if(key==list.Data.Count){
                    i = key;
                    break;
                }
                id = list.Data[key].Id;
                if (!string.IsNullOrEmpty(list.Data[key].Logo))
                {
                    imgurl = list.Data[key].Logo.Split(';')[0];
                }else{
                    imgurl = "";
                }
                sellProductNumber = new Order().Count(c => c.AreaCode == 10 && c.BusinessID == id);
                string[] startTimeArr = list.Data[key].DeliveryTime.Split('|');
                string[] endTimeArr = list.Data[key].DeliveryTimeEnd.Split('|');
                
                if(startTimeArr!=null&&startTimeArr.Length!=0){
                    for (int timeIndex = 0; timeIndex < startTimeArr.Length; timeIndex++)
                    {
                        if (Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " + startTimeArr[timeIndex]+":00") < DateTime.Now &&
                            DateTime.Now < Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " + endTimeArr[timeIndex] + ":00"))
                        {
                            isWork = "正在营业";
                            url = "/shop/FastFoodBusiness?d=" + list.Data[key].Id;
                        }
                        else{
                            isWork = "已打烊";
                            url = "#";
                        }
                    }
                }
                
                <div class="span4 merchant">
        <!--cover:215x139-->
        <a href="@url"><img src="@imgurl"  alt="@list.Data[key].Name" style="width:290px; height:143px;"/></a>
        <h4><a href="@url">@list.Data[key].Name</a></h4>

        <div style="line-height:25px;">
            <a href="#">@list.Data[key].MainSell</a>
        </div>
        <div>
            <span class="label label-info">订&nbsp;购:&nbsp;@sellProductNumber</span>
            <span class="label label-important">评&nbsp;价:&nbsp;@list.Data[key].Levels</span>
            <span  class="label label-info">@isWork</span>
        </div>
    </div>
                key++;
            }
    
    }
</div>
    <br/>
        }

    }
    else
    {
    <div style="margin-left:80px; margin-top:80px"><p style="vertical-align:middle">
                <b style="font-size: 20px; color: Green">没有相关数据！</b></p></div>
    }
    }  

<!--#商家列表-->
<!--分页-->
<div class="pagination text-right">
    <hr/>
    @Html.Raw(list.PageItemSegment)
</div>
<!--#分页-->
    
</div>


</div>
</div>

